16 Neural Networks

Algorithmics 2025

Neural Networks

In machine learning, a neural network is a computational model inspired by the structure and function of biological neural networks.

A perceptron is the simplest form of such a model, representing a single unit of computation.

Neuron

Perceptron

A perceptron is the earliest form of a neural network unit, introduced by Frank Rosenblatt in 1958.
It is a binary classifier that makes predictions based on a linear combination of input features.

Components:

  • Inputs: \((x_1, x_2, \dots, x_n)\)
  • Weights: \((w_1, w_2, \dots, w_n)\) – relative importance of features
  • Bias: \(b\), shifts the decision boundary
  • Activation Function: step function threshold

perceptron

Perceptron

Perceptron

Perceptron (Mathematics)


y = \[\begin{cases} 1 & \text{if } \displaystyle \sum_{i=1}^{n} w_i x_i + b > 0 \\ 0 & \text{if } \displaystyle \sum_{i=1}^{n} w_i x_i + b \leq 0 \end{cases}\]


The output is binary (0 or 1), making it suitable for linearly separable classification problems.

Example: Spam Filter

  • We design a perceptron with the following setup:

  • \(x_1\): number of times the word “free” appears

  • \(x_2\): whether the email has an attachment (0/1)

  • \(x_3\): length of the subject line

  • Weights: \(w_1 = 2,\; w_2 = 3,\; w_3 = -0.5\)

  • Bias: \(b = -4\)

  1. Will the perceptron classify an email with \(x_1 =3, x_2 = 1 \text{ and } x_3 = 6\) as spam?
  2. Which feature is the most important
  3. What should the bias be adjusted to so that the email is not classified as spam

But what is a neural network? 3Blue1Brown